package com.lianzhihui.romeex.mvp.presenter;

import android.content.Context;

import com.lianzhihui.romeex.bean.TradeRecordBean;
import com.lianzhihui.romeex.bean.TradeRecordEarningsBean;
import com.lianzhihui.romeex.mvp.model.TradeRecordInterface;
import com.lianzhihui.romeex.mvp.model.TradeRecordModelImp;
import com.lianzhihui.romeex.mvp.view.ZZRecordView;

//逻辑实现
public class TradeRecordPresnterImp implements TradeRecordInterface {

    private final ZZRecordView viewLayer;
    private final TradeRecordModelImp modelImp;

    public TradeRecordPresnterImp(Context context, ZZRecordView viewLayer) {
        this.viewLayer = viewLayer;
        modelImp = new TradeRecordModelImp(context, this);
    }

    public void requestTradeRecord(int page, int pageSize, String coinName, String coinNameCobo, String tradeType) {
        modelImp.requestTradeRecord(page, pageSize, coinName, coinNameCobo, tradeType);
    }

    public void requestTradeRecord(int page, String coinName, String coinNameCobo, String tradeType) {
        modelImp.requestTradeRecord(page, 20, coinName, coinNameCobo, tradeType);
    }

    public void requestWalletProfitlist(int page, int pageSize) {
        modelImp.requestWalletProfitlist(page, pageSize);
    }


    @Override
    public void responseSuccess(TradeRecordBean b) {
        viewLayer.success(b);
    }

    @Override
    public void responseWalletProfitlistSuccess(TradeRecordEarningsBean b) {
        viewLayer.responseWalletProfitlistSuccess(b);
    }

    @Override
    public void responseFailed(int codeError, String msg) {
        viewLayer.failed(codeError, "error");
    }

}
